How can Java be improved so that it no longer needs to perform type erasure? [closed]

Posted by user63904 on Programmers See other posts from Programmers or by user63904
Published on 2012-06-05T12:24:04Z Indexed on 2012/06/06 22:47 UTC
Read the original article Hit count: 265

Filed under:
|

The official Java tutorial on generics explains type erasure and why it was added to the compiler:

When a generic type is instantiated, the compiler translates those types by a technique called type erasure — a process where the compiler removes all information related to type parameters and type arguments within a class or method. Type erasure enables Java applications that use generics to maintain binary compatibility with Java libraries and applications that were created before generics.

This most likely was a pragmatic approach, or perhaps the least painful one. However, now that generics is widely supported across the industry, what can be done in order for us to not need type erasure? Is it feasible with out needing to break backwards compatibility, or if it is feasible, is it practical?

Has the last the last statement in the quote above become self referential? That is: "type erasure enables Java applications that use generics to maintain binary compatibility with Java libraries and applications that were created with Java versions that perform type erasure."

© Programmers or respective owner

Related posts about java

Related posts about jvm